const app = getApp()
Page({
  data: {
    // 热门搜索
    list: [],
    key: '',
  },
  onLoad: function (options) {
    this._getList()
  },
  async _getList() {
    let res = await wx.requestAsync({
      url: 'index/hotsh',
    })
    console.log(res)
    const list = res.res.list
    this.setData({
      list,
    })
  },
  _confirm(e) {
    this.setData({ key })
    let key = e.detail.value
    app.globalData.key = key
    wx.switchTab({
      url: '/pages/index/index',
    })
  },
  // 跳转首页
  _toIndex(e) {
    console.log()
    let key = e.currentTarget.dataset.title
    app.globalData.key = key
    wx.switchTab({
      url: '/pages/index/index',
    })
  },
  // 点击取消
  bindCancel: function () {
    console.log('bindCancel')
    this.setData({
      key: null,
    })
    app.globalData.key = null
    wx.navigateBack({
      delta: 1,
    })
  },
})
